<?php
//qier
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'website';
$return=array();
$tabs=array(
	array('op'=>'website','title'=>'内容网站类'),
	array('op'=>'third','title'=>'第三方服务平台类'),
);
if($_RQ['op']=='website'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('client_id','client_secret','pingtai','classify'),$postdata);
		$this->plugin_setting('website',$data);
		exi('设置成功');
	}
	$title='$title';
	$content='$content';
	$cover_pic='$cover_pic';
	$return['item']=$this->plugin_setting('website');
	$return['item']['func1']="cfc('jy_qier')->article($title,$content,$cover_pic),$title 文章标题，$content 文章内容，$cover_pic 文章封面图";
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
		    array('type'=>'string','title'=>'client_id','name'=>'client_id','help'=>'https://open.om.qq.com申请获取'),
			array('type'=>'string','title'=>'client_secret','name'=>'client_secret','help'=>'https://open.om.qq.com申请获取'),
			array('type'=>'select','title'=>'原创首发平台','name'=>'pingtai','options'=>'pingtai','option_title'=>'name'),
			//array('type'=>'select','title'=>'文章分类','name'=>'classify','options'=>'classify','option_title'=>'name'),
			array ('name' => 'func1','type' => 'string','title' => '文章发文方法为','read'=>true,'help'=>'更多使用方法请参考官方文档：https://open.om.qq.com/resources/resourcesCenter'),
		),
	);
	$return['pingtai']=array(array('id'=>1,'name'=>'企鹅号'),array('id'=>2,'name'=>'微信公众账号'),array('id'=>3,'name'=>'头条号'),array('id'=>4,'name'=>'大鱼号'),array('id'=>5,'name'=>'一点号'),array('id'=>6,'name'=>'百家号'),array('id'=>7,'name'=>'网易号'),array('id'=>8,'name'=>'搜狐号'),array('id'=>9,'name'=>'淘宝头条'),array('id'=>10,'name'=>'其他平台'));
	//$return['classify']=array(array('id'=>1,'name'=>'旅游'),array('id'=>2,'name'=>'游戏'),array('id'=>4,'name'=>'体育'),array('id'=>9,'name'=>'美食'),array('id'=>10,'name'=>'健康'),array('id'=>13,'name'=>'财经'),array('id'=>14,'name'=>'汽车'),array('id'=>15,'name'=>'房产'),array('id'=>16,'name'=>'动漫'),array('id'=>17,'name'=>'教育'),array('id'=>18,'name'=>'科技'),array('id'=>19,'name'=>'军事'),array('id'=>20,'name'=>'天气'),array('id'=>21,'name'=>'情感'),array('id'=>28,'name'=>'招聘'),array('id'=>40,'name'=>'鸡汤'),array('id'=>41,'name'=>'社会'),array('id'=>42,'name'=>'时政'),array('id'=>128,'name'=>'NBA'),array('id'=>141,'name'=>'CBA'),array('id'=>306,'name'=>'新闻'));
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='third'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('client_id','client_secret'),$postdata);
		$this->plugin_setting('third',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('third');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			array('type'=>'string','title'=>'client_id','name'=>'client_id','help'=>''),
			array('type'=>'string','title'=>'client_secret','name'=>'client_secret'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
